import request from "@/utils/request";

function page(current, size, courseName,
    approverName, approvalStatus) {
    return request({
        method: 'GET',
        url: '/assessment_application/page',
        params:{
            current:current,
            size:size,
            courseName:courseName,
            approverName:approverName,
            approvalStatus:approvalStatus
        }
    });
}

function page_by_id(current, size, applicantId, courseName,
    approverName, approvalStatus) {
    return request({
        method: 'GET',
        url: '/assessment_application/page_by_applicant_id',
        params:{
            current:current,
            size:size,
            applicantId:applicantId,
            courseName:courseName,
            approverName:approverName,
            approvalStatus:approvalStatus
        }
    });
}

function add(reason, courseId, applicantId, assessmentMethod){
    return request({
        method: 'POST',
        url: '/assessment_application',
        data:{
            reason:reason,
            courseId:courseId,
            applicantId:applicantId,
            assessmentMethod:assessmentMethod,
        }
    });
}

function edit(id, reason, courseId, applicantId, assessmentMethod){
    return request({
        method: 'PUT',
        url: '/assessment_application',
        data:{
            id:id,
            reason:reason,
            courseId:courseId,
            applicantId:applicantId,
            assessmentMethod:assessmentMethod,
        }
    });
}

function del(id){
    return request({
        method: 'DELETE',
        url: `/assessment_application/${id}`,
    });
}

export default {
    page,
    page_by_id,
    add,
    edit,
    del
}